<?php

class Ext_Image_Show_Adapter extends Ext_Image_Show_Abstract
{
    protected $_adapter;

    public function __construct()
    {
        $config = Ext_Config::getInstance()->getConfig('image');

        $classname = "Ext_Image_Show_Adapter_".ucfirst($config->storage->adapter);
        if(!class_exists( $classname ))
        {
            require_once 'Ext/Image/Show/Exception.php';
            throw new Ext_Image_Show_Exception("Image show adapter '".$classname."' is not exists.");
        }
        
        $this->_adapter = new $classname();
    }
    
    public function build($imageId)
    {
        $this->_adapter->build($imageId);
        
        $this->source = $this->_adapter->source;
        $this->big    = $this->_adapter->big;
        $this->middle = $this->_adapter->middle;
        $this->small  = $this->_adapter->small;
        $this->thumb  = $this->_adapter->thumb;
    }

}
